package com.jm.day24.e_demo3.dao;

import com.jm.day24.utils.JdbcUtils;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

public class AccountDao {
    /**
     *
     * @param out
     * @param money
     * @throws SQLException
     */
    public void out (String out ,Double money) throws SQLException {
        QueryRunner runner = new QueryRunner();
        runner.update(JdbcUtils.getConnection(),"update account set money=money-? where username=?",money,out);
    }

    /**
     *
     * @param in
     * @param money
     * @throws SQLException
     */
    public void in (String in ,Double money) throws SQLException {
        QueryRunner runner = new QueryRunner();
        runner.update(JdbcUtils.getConnection(),"update account set money=money-? where username=?",money,in);
    }
}
